from pyecharts.charts import Map
from pyecharts.options import *
map = Map()
data = [
    ("北京市",99),
    ("上海市",199),
    ("湖南省",299),
    ("台湾省",199),
    ("安徽省",29999),
    ("广东省",399),
    ("湖北省",599)
]
map.add("地图",data,"china")
map.set_global_opts(
    visualmap_opts=VisualMapOpts(
        is_show=True,
        # 手动校准范围
        is_piecewise=True,
        # 校准范围参数
        pieces=[
            {"min":1,"max":9,"label":"1-9","color":"#CCFFFF"},
            {"min":10,"max":99,"label":"10-99","color":"#FFFF99"},
            {"min":100,"max":499,"label":"100-499","color":"#FF9966"},
            {"min":500,"max":999,"label":"500-999","color":"#FF6666"},
            {"min":1000,"max":9999,"label":"1000-9999","color":"#CC3333"},
            {"min":10000,"label":"10000以上","color":"#990033"},
        ]
    )
)
map.render()